<?php

namespace App\Services;


/**
 * Class ShopNotice
 * @package App\Services
 * 2021/3/18 - 14:45
 * Administrator
 * 商城通知 服务
 */
class ShopNotice extends BaseService
{
    /**
     * 2021/3/18--14:48
     * @author:董宗澳
     * @email:2453611300
     * @wechat:DZA74941
     * @QQ:2453611300
     * @web:www.quzha.net
     * @method:getNotice
     * @effect:获取通知列表
     */
    public function getNotice()
    {
        $model = new \App\Models\ShopNotice();
        $user_service = new UserService;
        $user_info = $user_service->getUserInfo();
        $list = $model->where('user_id', $user_info['id'])->update([
            'is_read' => 1
        ]);
        $list = $model->where('user_id', $user_info['id'])->get();
        return $this->format($list);
    }


    /**
     * 2021/3/18--15:27
     * @author:董宗澳
     * @email:2453611300
     * @wechat:DZA74941
     * @QQ:2453611300
     * @web:www.quzha.net
     * @method:addNotice
     * @effect:添加消息通知
     */
    public function addNotice($data)
    {
        $model = new \App\Models\ShopNotice();
        $model->insert($data);
    }

}
